{include file="header.html"}
<body class="gr">

<div class="navBar">
	<a class="left" href="javascript:history.back()"><i class="return"></i></a>
	<div class="titleView-x">{if isset($id)}修改{else}新建{/if}参保人</div>
</div>

<div class="cart-person-edit main-top">
	<form action="api.php?app=cart&act=person_edit" method="post">
	<input type="hidden" name="id" value="{$data->id}" />
	<div class="view">
		<div class="ge-bottom"><input type="text" id="name" name="name" value="{$data->name}" maxlength="20" placeholder="请输入真实姓名(必填)" /><span>姓名</span></div>
		<div class="ge-bottom"><input type="tel" id="mobile" name="mobile" value="{$data->mobile}" maxlength="11" placeholder="请输入手机号码(必填)" /><span>手机号码</span></div>
		<div class="ge-bottom"><input type="text" id="idcard" name="idcard" value="{$data->idcard}" maxlength="18" placeholder="请输入身份证号(必填)" /><span>身份证号</span></div>
		<div class="ge-bottom"><input type="text" id="social_number" name="social_number" value="{$data->social_number}" maxlength="18" placeholder="请输入社保号(选填)" /><span>社保号</span></div>
		<div class="ge-bottom"><input type="text" id="gjj_number" name="gjj_number" value="{$data->gjj_number}" maxlength="18" placeholder="请输入公积金账号(选填)" /><span>公积金账号</span></div>
		<div class="ge-bottom">
			<a href="javascript:void(0)" class="back" {if $data->idcard_pic2!=''}style="background-image:url({$data->idcard_pic2});"{/if}>﹢反面<input type="hidden" id="idcard_pic2" name="idcard_pic2" value="{$data->idcard_pic2}" /></a>
			<a href="javascript:void(0)" class="front" {if $data->idcard_pic1!=''}style="background-image:url({$data->idcard_pic1});"{/if}>﹢正面<input type="hidden" id="idcard_pic1" name="idcard_pic1" value="{$data->idcard_pic1}" /></a>
			<span>身份证照片</span>
		</div>
		<a href="wap.php?app=cart&act=person_type"><span class="text {if $data->type!=''}text-x{/if}">{if $data->type!=''}{$data->type}{else}请选择户籍类型(必选){/if}</span><span>户籍类型</span></a>
		<input type="hidden" id="type" name="type" value="{$data->type}" />
	</div>
	</form>

	<div class="buttonView">
		<a href="javascript:void(0)" class="btn">提交</a>
	</div>
	{if $data->id>0}
	<div class="buttonView delete">
		<a href="wap.php?app=cart&act=person_delete&id={$data->id}" class="delete" style="background: red; color: white">删除</a>
	</div>
	{/if}
</div>

{include file="footer.html"}
<script>
$(function(){
	$('.cart-person-edit .front, .cart-person-edit .back').ajaxupload({
		url : 'api.php?app=cart&act=idcard_pic',
		name : 'idcard_pic',
		innerFile : false,
		before : function(){
			$.overload();
		},
		callback : {
			success : function(json, status){
				if(json.error!=0){ $.overloadError(json.msg);return }
				$(this).css('background-image', 'url('+json.data+')');
				$(this).find('input').val(json.data);
			},
			error : function(xml, status, e){
				alert('Upload error\n'+e);
			}
		}
	});
	$('.cart-person-edit .btn').click(function(){
		formBodyView(function(json){
			popBodyView();
		});
	});
	pushBodyView('.cart-person-edit .view > a', function(){
		$('.cart-person-type .view a').click(function(){
			$(this).addClass('selected').siblings().removeClass('selected');
		});
		$('.cart-person-type .btn').click(function(){
			if(!$('.cart-person-type .selected').length){
				$.overloadError('请选择户籍类型');
				return;
			}
			var type = $('.cart-person-type .selected').text();
			var delegate = delegateBodyView();
			if(!delegate.length)return;
			delegate.find('#type').val(type);
			delegate.find('.view > a .text').addClass('text-x').html(type);
            popBodyView();
		});
	});
});
</script>